﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<SearchUI.Models.SearchModel>" %>

<asp:Content ID="indexHead" ContentPlaceHolderID="head" runat="server">
    <title>Search Subversion</title>
</asp:Content>

<asp:Content ID="indexContent" ContentPlaceHolderID="MainContent" runat="server">
<form action="Search/RunSearch" method="post" onsubmit="return false;">
<span>
<img src="Content/logo.jpg" style="vertical-align:middle;" /><span >&nbsp;&nbsp;<input type="text" size="80" name="search_terms" id="search_terms" />&nbsp;in&nbsp;<select name="Formats" id="FormatMenu"><option value="">Any Format</option><option value="pdf">PDF</option><option value="doc">Word</option><option value="xls">Excel</option><option value="ppt">Power Point</option><option value="htm">HTML</option></select>&nbsp;&nbsp;<input type="submit" value="Search" id="go_search_button" /></span>
</span>        
</form>
    
    
        <div id="search_results">
    
    </div>

    <script type="text/javascript">
        $().ready(function() {

            $('#go_search_button').click(function() {
                var date = new Date();
                $('#search_results').html('<div style="display:block;text-align: center; margin: 50px 0 0 280px ; width:18em;"><img src="Content/spinner-big.gif" /><br/><br/><span class="loading">Loading...</span><br/><br/><br/></div>');
                $.ajax({
                    url: 'Search/RunSearch',
                    data: 'search_terms=' + $('#search_terms').val() + '&time=' + date.getTime() + '&sortBy=Rank&reverseSort=0&format=' + $('#FormatMenu :selected').val(),
                    type: 'POST',
                    dataType: 'html',
                    timeout: 20000,
                    error: function() {
                        alert('Error running the search');
                    },
                    success: function(TheHtml) {
                        $('#search_results').html(TheHtml).show('1');
                    }
                });
            });
        }); 
    </script>

    
</asp:Content>
